#!/bin/bash -e

function info() {
    echo Usage: `basename $0` '[-wrm] in.bam'
    exit 1
}

while getopts ":p:f:w:r:m" opt; do
    case  $opt  in
        p) out_prefix=$OPTARG;;
        f) suffix=$OPTARG;;
        w) win_len=$OPTARG;;
        r) read_th=$OPTARG;;
        m) method=$OPTARG;;
        *) info;;
    esac
done
shift $(($OPTIND - 1))

if [ $# -lt 1 ]; then info; fi

# . $var

# export PATH=~/yn/tools/conda/bin:$PATH
unset PYTHONPATH
. ~/yn/tools/conda/bin/activate py36
# pip show umi_tools

method=${method:=directional}

umi_tools group \
-I $1 -S $out_prefix.group.bam \
--paired \
--umi-separator=":" \
--output-bam \
--group-out=$out_prefix.group.tsv

samtools index $out_prefix.group.bam

# . $cmd_done
